<template>
  <!-- 显示更多 -->
  <div class="more">
    <!-- <h2 class="text-xl mb-2 text-white">Stake - 在线赌场和体育博彩平台</h2> -->
    <div
      :class="showMore ? '' : 'showless'"
      style="display: flex; flex-direction: column; width: 100%"
    >
      <div
        class="content-block text-white"
        ref="conRef"
        v-html="main2.htmlInfo"
      ></div>
    </div>
    <div
      class="flex justify-center mt-4"
      :class="showMore ? 'relative' : 'btn'"
    >
      <button
        v-if="showBtn"
        @click="toggleMore"
        class="bg-gray-700 text-white px-4 py-2 rounded hover:bg-gray-600"
      >
        {{ showMore ? $t("page.home.less") : $t("page.home.more") }}
      </button>
    </div>
  </div>
</template>
<script setup>
import {
  ref,
  onMounted,
  onBeforeUnmount,
  watch,
  computed,
  nextTick
} from "vue";
import { mainAct } from "../../store/activeda";
const showMore = ref(false);
const main2 = mainAct();
const toggleMore = () => {
  showMore.value = !showMore.value;
};
const htmlInfo = ref(null);
const conRef = ref(null);
const showBtn = ref(false);
const gethallIntro = async () => {
  // await main2.gethallIntro();

  // console.log(conRef.value);
  await nextTick();
  // console.log(conRef.value.clientHeight);
  if (conRef.value.clientHeight < 250) {
    showBtn.value = false;
    showMore.value = true;
  } else {
    showBtn.value = true;
    showMore.value = false;
  }
};
onMounted(() => {
  gethallIntro();
});
</script>
<style lang="less" scoped>
.more {
  padding: 1rem;
  position: relative;
  background-color: #0f212e;
  margin: 1rem 0;
  li {
    list-style: disc;
    margin: 0.25rem 0;
  }
  p {
    color: #fff;
    display: inline-block;
    margin-bottom: 1.25rem;
  }
  h2 {
    display: inline-block;
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    span {
      color: #fff;
      font-weight: 600;
    }
  }
  span {
    color: #b1bad3;
  }
  .btn {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 2.5rem;
    width: 100%;
    display: flex;
    justify-content: center;
    z-index: 2;
  }
}
.showless {
  height: 250px;
  overflow: hidden;
  position: relative;
}
.showless::before {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  content: "";
  width: 100%;
  height: 100%;
  background: linear-gradient(0deg, #0f212e 0%, rgba(15, 33, 46, 0) 100%);
}
.content-block {
  li {
    list-style: disc;
    margin: 0.25rem 0;
  }
  p {
    color: #fff !important;
    display: inline-block;
    margin-bottom: 1.25rem;
  }
  h2 {
    display: inline-block;
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    span {
      color: #fff;
      font-weight: 600;
    }
  }
  span {
    color: #b1bad3;
  }
}
</style>
